Windows作業系統
Mac作業系統
2024/09/01
2024/09/02
2024/09/03
2024/09/04
2024/09/05
cat('2024/09/0',1)
cat('2024/09/0',2)
cat('2024/09/0',3)
cat('2024/09/0',4)
cat('2024/09/0',5)
cat('2024/09/0',1, sep='')
cat('2024/09/0',2)
cat('2024/09/0',3)
cat('2024/09/0',4)
cat('2024/09/0',5)
cat('2024/09/0',1, sep='')
cat('2024/09/0',2, sep='')
cat('2024/09/0',3, sep='')
cat('2024/09/0',4, sep='')
cat('2024/09/0',5, sep='')
for (i in 1:5){
print(i)
}
for (i in 1:5){
cat('2024/09/0',i, sep='')
}
for (i in 1:5){
cat('2024/09/0',i, sep='')
cat('\n')
}
as.Date('2024/09/01',format='%Y/%m/%d')
setwd('/Users/carplee/Desktop/files/IT python')
r = read.csv('data/volcano_utf8.csv')
colnames(r)
[1] "日期" "數量"
library(ggplot2)
x=r$日期
y=r$數量
ggplot(r, aes(x,y))+
geom_line()
class(r$日期)
[1] "integer"
r$日期=as.character(r$日期)
d = as.Date(r$日期,"%Y%m%d")
[1] "2023-01-01" "2023-01-02" "2023-01-03" "2023-01-04"
[5] "2023-01-05" "2023-01-06" "2023-01-07" "2023-01-08"
[9] "2023-01-09" "2023-01-10" "2023-01-11" "2023-01-12"
[13] "2023-01-13" "2023-01-14" "2023-01-15" "2023-01-16"
[17] "2023-01-17" "2023-01-18" "2023-01-19" "2023-01-20"
[21] "2023-01-21" "2023-01-22" "2023-01-23" "2023-01-24"
[25] "2023-01-25" "2023-01-26" "2023-01-27" "2023-01-28"
[29] "2023-01-29" "2023-01-30" "2023-01-31" "2023-02-01"
[33] "2023-02-02" "2023-02-03" "2023-02-04" "2023-02-05"
[37] "2023-02-06" "2023-02-07" "2023-02-08" "2023-02-09"
[41] "2023-02-10" "2023-02-11" "2023-02-12" "2023-02-13"
[45] "2023-02-14" "2023-02-15" "2023-02-16" "2023-02-17"
[49] "2023-02-18" "2023-02-19" "2023-02-20" "2023-02-21"
[53] "2023-02-22" "2023-02-23" "2023-02-24" "2023-02-25"
[57] "2023-02-26" "2023-02-27" "2023-02-28" "2023-03-01"
[61] "2023-03-02" "2023-03-03" "2023-03-04" "2023-03-05"
[65] "2023-03-06" "2023-03-07" "2023-03-08" "2023-03-09"
[69] "2023-03-10" "2023-03-11" "2023-03-12" "2023-03-13"
[73] "2023-03-14" "2023-03-15" "2023-03-16" "2023-03-17"
[77] "2023-03-18" "2023-03-19" "2023-03-20" "2023-03-21"
[81] "2023-03-22" "2023-03-23" "2023-03-24" "2023-03-25"
[85] "2023-03-26" "2023-03-27" "2023-03-28" "2023-03-29"
[89] "2023-03-30" "2023-03-31" "2023-04-01" "2023-04-02"
[93] "2023-04-03" "2023-04-04" "2023-04-05" "2023-04-06"
[97] "2023-04-07" "2023-04-08" "2023-04-09" "2023-04-10"
[101] "2023-04-11" "2023-04-12" "2023-04-13" "2023-04-14"
[105] "2023-04-15" "2023-04-16" "2023-04-17" "2023-04-18"
[109] "2023-04-19" "2023-04-20" "2023-04-21" "2023-04-22"
[113] "2023-04-23" "2023-04-24" "2023-04-25" "2023-04-26"
[117] "2023-04-27" "2023-04-28" "2023-04-29" "2023-04-30"
[121] "2023-05-01" "2023-05-02" "2023-05-03" "2023-05-04"
[125] "2023-05-05" "2023-05-06" "2023-05-07" "2023-05-08"
[129] "2023-05-09" "2023-05-10" "2023-05-11" "2023-05-12"
[133] "2023-05-13" "2023-05-14" "2023-05-15" "2023-05-16"
[137] "2023-05-17" "2023-05-18" "2023-05-19" "2023-05-20"
[141] "2023-05-21" "2023-05-22" "2023-05-23" "2023-05-24"
[145] "2023-05-25" "2023-05-26" "2023-05-27" "2023-05-28"
[149] "2023-05-29" "2023-05-30" "2023-05-31" "2023-06-01"
[153] "2023-06-02" "2023-06-03" "2023-06-04" "2023-06-05"
[157] "2023-06-06" "2023-06-07" "2023-06-08" "2023-06-09"
[161] "2023-06-10" "2023-06-11" "2023-06-12" "2023-06-13"
[165] "2023-06-14" "2023-06-15" "2023-06-16" "2023-06-17"
[169] "2023-06-18" "2023-06-19" "2023-06-20" "2023-06-21"
[173] "2023-06-22" "2023-06-23" "2023-06-24" "2023-06-25"
[177] "2023-06-26" "2023-06-27" "2023-06-28" "2023-06-29"
[181] "2023-06-30" "2023-07-01" "2023-07-02" "2023-07-03"
[185] "2023-07-04" "2023-07-05" "2023-07-06" "2023-07-07"
[189] "2023-07-08" "2023-07-09" "2023-07-10" "2023-07-11"
[193] "2023-07-12" "2023-07-13" "2023-07-14" "2023-07-15"
[197] "2023-07-16" "2023-07-17" "2023-07-18" "2023-07-19"
[201] "2023-07-20" "2023-07-21" "2023-07-22" "2023-07-23"
[205] "2023-07-24" "2023-07-25" "2023-07-26" "2023-07-27"
[209] "2023-07-28" "2023-07-29" "2023-07-30" "2023-07-31"
[213] "2023-08-01" "2023-08-02" "2023-08-03" "2023-08-04"
[217] "2023-08-05" "2023-08-06" "2023-08-07" "2023-08-08"
[221] "2023-08-09" "2023-08-10" "2023-08-11" "2023-08-12"
[225] "2023-08-13" "2023-08-14" "2023-08-15" "2023-08-16"
[229] "2023-08-17" "2023-08-18" "2023-08-19" "2023-08-20"
[233] "2023-08-21" "2023-08-22" "2023-08-23" "2023-08-24"
[237] "2023-08-25" "2023-08-26" "2023-08-27" "2023-08-28"
[241] "2023-08-29" "2023-08-30" "2023-08-31" "2023-09-01"
[245] "2023-09-02" "2023-09-03" "2023-09-04" "2023-09-05"
[249] "2023-09-06" "2023-09-07" "2023-09-08" "2023-09-09"
[253] "2023-09-10" "2023-09-11" "2023-09-12" "2023-09-13"
[257] "2023-09-14" "2023-09-15" "2023-09-16" "2023-09-17"
[261] "2023-09-18" "2023-09-19" "2023-09-20" "2023-09-21"
[265] "2023-09-22" "2023-09-23" "2023-09-24" "2023-09-25"
[269] "2023-09-26" "2023-09-27" "2023-09-28" "2023-09-29"
[273] "2023-09-30" "2023-10-01" "2023-10-02" "2023-10-03"
[277] "2023-10-04" "2023-10-05" "2023-10-06" "2023-10-07"
[281] "2023-10-08" "2023-10-09" "2023-10-10" "2023-10-11"
[285] "2023-10-12" "2023-10-13" "2023-10-14" "2023-10-15"
[289] "2023-10-16" "2023-10-17" "2023-10-18" "2023-10-19"
[293] "2023-10-20" "2023-10-21" "2023-10-22" "2023-10-23"
[297] "2023-10-24" "2023-10-25" "2023-10-26" "2023-10-27"
[301] "2023-10-28" "2023-10-29" "2023-10-30" "2023-10-31"
>
ggplot(r, aes(d, y))+
geom_line()
ggplot(r, aes(d, y))+
geom_line()+
scale_x_date(date_breaks = "months")
ggplot(r, aes(d, y))+
geom_line()+
scale_x_date(date_breaks = "months",date_labels = "%Y-%m")
ggplot(r, aes(d, y))+
geom_line()+
scale_x_date(date_breaks = "months",date_labels = "%Y-%m")+
theme(axis.text.x=element_text(angle = 30))